package cn.geminis.lowcode.compiler.code;

import cn.geminis.lowcode.compiler.util.JdkTreeMakerUtils;
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.UnaryTree;

/**
 * @author puddi
 */
public class LcUnary extends AbstractExpression<ExpressionTree> {

    private final String opcode;
    private final AbstractExpression<?> expression;

    public LcUnary(String opcode, AbstractExpression<?> expression) {
        this.opcode = opcode;
        this.expression = expression;
    }

    @Override
    protected UnaryTree createJdkTree() {
        return JdkTreeMakerUtils.unary(opcode, expression.getJdkTree());
    }
}
